<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>商户审核</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon"/>
    <!-- 当前页面样式 -->
    <link rel="stylesheet" href="<s:url value="/css/common.css"/>"/>
    <!-- 当前页面样式 END -->
    <script type="text/javascript" src="<c:url value="/js/jquery-1.3.2.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
	<script type='text/javascript' src='<s:url value="/js/pageAjax.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/js/querySon.js"/>'></script>
	<script type="text/javascript">
	$(document).ready(function() {
		$('#assign').click(function(){
			var dd = $("input[name=multi_sel]:checked");
			if(dd.length != 1){
				alert("请选择一条记录");
				return false;
			}
			var idd = dd.val();							
			if(dd.length == 0){
				alert("请选择记录");
				return false;
			}else{
				$("#assign").attr("disabled",true);
				window.location.href='<%=basePath%>/formalMerinfo/merInfoAssginInit.ct?merinfo.id='+idd;
			}
		});
	});
	
	function queryForm(obj){
		debugger;
		var merchantNo=$("#merchantNo").val();
		var merchantName=$("#merchantName").val(); 
		var certifName=$("#certifName").val();
		var cardNo=$("#cardNo").val();
		var minDate=$("#minDate").val();
		var maxDate=$("#maxDate").val();
		var date1=str2date($("#minDate").val());
		var date2=str2date($("#maxDate").val());
		
		var date4=new Date();    //结束时间

		if(minDate!=""||maxDate!=""){
			if(maxDate<minDate){
				alert("起始日期应小于结束日期");
				return false;
			}
			var date3=date4.getTime()-date1.getTime();  //时间差的毫秒数
			var days=Math.floor(date3/(24*3600*1000));
			
			/* if(date1.getMonth()!=date2.getMonth()){
				debugger;
				alert("选择的起止时间不在同一个月内！");
				return false;
			} */
		/* 	if(days > 90|| days<0){
				alert("只能查最近三个月的商户！");
				return false;
			} */
		}
		
		if(merchantNo!="" ||merchantName!="" ||certifName!="" ||cardNo!="" ||minDate!="" ||maxDate!="" )
		{
			$("#"+obj.id).attr("disabled",true);
			$("#queryUserForm").attr("action",'<s:url value="/formalMerinfotp/queryList.ct"/>');
			$("#queryUserForm").submit();	
			
		}else{
			alert("商户号、商户名、法人身份证号、法人姓名、进件日期至少必录一项！");
			return false;
		}
			
	}
	
	function   str2date(str){   
		var   d=null;   
		var   reg=/^(\d{4})-(\d{2})-(\d{2})$/  ;
		if(arr=str.match(reg)) d=new Date(Number(arr[1]),Number(arr[2])-1,Number(arr[3])) ; 
		return   d;   
	}
	
	function isDetail(str){
		$("#queryUserForm").attr("action","<%=basePath%>/formalMerinfo/queryMerchtDetail.ct?merinfo.id="+str);
		$("#queryUserForm").submit();
	}	
	$(document).ready(function(){
		var uId=$("#userId").val();
	 	loadProvince(uId);
	 	 //冻结
	 	 $("#freezeMerinfoBtnNew").click(function(){
		    	var mid=checkChooseNum();
		    	if(!mid){
		    		return;
		    	}
		    	$("#queryUserForm").attr("action","<%=basePath%>/formalMerinfo/freezePage.ct?merinfo.id="+mid+"&merinfo.status=03");
				$("#queryUserForm").submit();
		    }); 
	 	 //解冻
	 	 $("#resetFreezeMerinfoBtnNew").click(function(){
		    	var mid=checkChooseNum();
		    	if(!mid){
		    		return;
		    	}
		    	$("#queryUserForm").attr("action","<%=basePath%>/formalMerinfo/freezePage.ct?merinfo.id="+mid+"&merinfo.status=01");
				$("#queryUserForm").submit();
		    });
	 	 //注销
	 	 $("#logoutMerinfoBtnNew").click(function(){
		    	var mid=checkChooseNum();
		    	if(!mid){
		    		return;
		    	}
		    	$("#queryUserForm").attr("action","<%=basePath%>/formalMerinfo/freezePage.ct?merinfo.id="+mid+"&merinfo.status=02");
				$("#queryUserForm").submit();
		    });
	 	 //导出
	 	$("#szPower").click(function() {
				$("#queryUserForm").attr("action","<%=basePath%>/formalMerinfo/exportmerinfoExcel.ct");
				$("#queryUserForm").submit();
	      });
	});
	
</script>
</head>
<body>
<s:form id="queryUserForm" action="/formalMerinfotp/queryList.ct" method="post" theme="simple">
<s:hidden id="userId" value="%{#session.session_merchant.id}"/>
<table class="tb">
    <tbody>
        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h2">POS收单运营管理平台</div></td>
        </tr>

        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h3">商户查询</div></td>
        </tr>
 
       <tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">商户号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.merchantNo"  id ="merchantNo" />
               	</label>
            </td>
             <td align="right" class="tb-td">
                <div class="tb-h4">商户名：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.merchantName" id ="merchantName" maxlength="20"/>
                </label>
            </td>
        </tr>
       <tr class="tb-line">
       		<td align="right" class="tb-td">
                <div class="tb-h4">法人姓名：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.certifName" id ="certifName" maxlength="20"/>
                </label>
            </td>
			<td align="right" class="tb-td">
                <div class="tb-h4">法人身份证号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="searchCondition.cardNo" id ="cardNo"  maxlength="20"/>
                </label>
            </td>
        </tr>
        <tr class="tb-line">
            <td align="right" class="tb-td">进件日期：</td>
			<td class="tb-td" colspan="3" >
				 <label class="tb-input-normal">
					<s:textfield    onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,wdate:true,errDealMode:0});" id ="minDate"    name="searchCondition.minDate"  />
				 </label>
				-
				 <label class="tb-input-normal">
					<s:textfield  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,wdate:true,errDealMode:0});" id ="maxDate"   name="searchCondition.maxDate"   />
				</label>
			</td>
        </tr>
        <tr class="tb-line">
            <td class="tb-td line-submit" align="right" colspan="4">
                <label class="tb-input-submit">
                    <input type="button" value="查询" id="queryBtn" onclick="queryForm(this)"/>
                </label>
                <label class="tb-input-submit">
                    <input type="reset" value="取消"/>
                </label>
            </td>
        </tr>
        <s:if test="#request.searchRsList != null && #request.searchRsList.size>0 ">
			<tr class="tb-line">
				<td class="tb-td paging"  align="left" colspan="4"> 
					 	<page:pageCount max_pages="11" totalPage="${requestScope.totalPage}"
						currentPage="${requestScope.currentPage}"
						action="${rootPath}/formalMerinfotp/queryList.ct?currentPage=" />

				</td>
			</tr>
		</s:if>
    </tbody>
</table>
</s:form>
<div class="big-tb">
    <table class="tb" style="width: 150%;">
        <thead>
            <tr class="tb-line">
                <th class="tb-th" colspan="22">商户基本信息列表</th>
            </tr>
            <tr class="tb-line bg-gray">
            	<s:if test="op.roleType==\"12\" || op.roleType==\"13\" ">
            		<th class="tb-th">选择</th>
            	</s:if>
				<th class="tb-th">商户号</th>
				<th class="tb-th">商户简称</th>
				<th class="tb-th">营业名称</th>
				<th class="tb-th">结算方式</th>
				<th class="tb-th">商户类别</th>
				<th class="tb-th">审核人员</th>
				<th class="tb-th">审核日期</th>
				<th class="tb-th">状态</th>
				<th class="tb-th">业务联系人</th>
				<th class="tb-th">业务联系人电话</th>
				<th class="tb-th">法人</th>
				<th class="tb-th">法人证件号</th>
				<th class="tb-th">结算银行</th>
				<th class="tb-th">联行号</th>
				<th class="tb-th">结算银行账号名称</th>
				<th class="tb-th">结算银行账号</th>
				<th class="tb-th">商户地址</th>
				<th class="tb-th">营业执照号</th>
            </tr>
        </thead>
        <tbody>
			<s:iterator value="#request.searchRsList" status="stat" id="sh">
				<tr class="tb-line" >
					<%-- <s:if test="op.roleType==\"12\" || op.roleType==\"13\" || op.roleType==\"03\" "> --%>
						<s:if test="op.roleType==\"12\" || op.roleType==\"13\"  ">
						<td class="tb-td" align="center">
							<input name="multi_sel" value="<s:property value="#sh.mid"/>" type="checkbox" />
						</td>
					</s:if>
					<td class="tb-td">
						<a href="javascript:isDetail(<s:property value="#sh.mid"/>)"><s:property value="#sh.mid"/></a>
					</td>
					<td class="tb-td"><s:property value="#sh.merName"/></td>
			        <td class="tb-td"><s:property value="#sh.merBrName"/></td>
			        <td class="tb-td">
			        	<s:iterator value="#sh.merCycle" var="c" status="aaa">
			        	  <s:property value="#c" />
			        	</s:iterator>
			        </td>
			       <td class="tb-td">
			       	 
			        	<s:if test="#sh.nationCd==\"0\"">个体户</s:if>
			        	<s:if test="#sh.nationCd==\"1\"">企业</s:if>
			        </td>
			        <td class="tb-td">
			        	<s:if test="#sh.bus_lic == \"\"">风控
			        	</s:if>
			        	<s:else>
			        		<s:property value="#sh.bus_lic"/> 
			        	</s:else>
			        </td>
			        <td class="tb-td">
			        <s:property value="#sh.applDate"/> 
			        </td>
			        <td class="tb-td"><font id="s_<s:property value="#sh.mid"/>"><s:property value="#sh.flag"/></font></td>
			        <td class="tb-td"><s:property value="#sh.perName"/></td>
			        <td class="tb-td"><s:property value="#sh.perPhone"/></td>
			        <td class="tb-td"><s:property value="#sh.interContact"/></td>
			        <td class="tb-td"><s:property value="#sh.cardNo"/></td>
			        <td class="tb-td"><s:property value="#sh.amount1"/></td>
			        <td class="tb-td"><s:property value="#sh.amount2"/></td>
			        <td class="tb-td"><s:property value="#sh.rsvl"/></td>
			        <td class="tb-td"><s:property value="#sh.rsvl3"/></td>
			        <td class="tb-td"><s:property value="#sh.addr"/></td>
			        <td class="tb-td"><s:property value="#sh.flagCode"/></td>
			      </tr>
			</s:iterator>		
        </tbody>
    </table>
   
</div>
 <s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>